const headPlugin = {
  install(Vue, options) {
    Vue.component('heading', {
      props: {
        level: {
          type: String,
          required: true
        },
        title: {
          type: String,
          required: true
        },
        icon: String
      },
      render(h) {
        let children = []
        if (this.icon) {
          children.push(h('svg', { class: 'icon' }, [h('use', { attrs: { 'xlink:href': '#icon-' + this.icon } })]))
        }
        children = children.concat(this.$slots.default)
        return h(
          "h" + this.level,
          { attrs: { title: this.title } },
          // 这里单纯的会保存 一个很重要的东西, 他是一个文本组件也可以是 
          children
        )
      },
    })
  }
}

if (typeof window !== 'undefined' && window.Vue) {
  window.Vue.use(headPlugin)
}